package com.rr.program._timeStamp;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 俩个时间戳相减
 *
 * @author : RENBIAO
 * @createTime : 2021/6/23 15:18
 */
public class TimeStampSubtraction {

    public static long getTimeDifValue() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //当前时间
        Date curDate = new Date(System.currentTimeMillis());
        Date parseDate = null;
        try {
            //过去时间
            parseDate = simpleDateFormat.parse("2021-06-23 15:45:00");
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return curDate.getTime() - parseDate.getTime();
    }
}
